package com.itheima.day5.improve.test2;

public class Temo extends Hero {

    public Temo() {
    }

    public Temo(String name, int hp, int mp, int damage, int defense) {
        super(name, hp, mp, damage, defense);
    }

    public boolean useMp(int mp) {
        if (super.getMp() > mp) {
            super.setMp(super.getMp() - mp);
            return true;
        } else {
            return false;
        }
    }

    public void attack1() {
        int mp = 50;
        int damage =5;
        String name="曼舞手雷";
        if (useMp(mp)) {
            use(damage,name);
        }else {
            fail();
        }
    }

    public void attack2() {
        int mp = 30;
        int damage =4;
        String name="致命华彩";
        if (useMp(mp)) {
            use(damage,name);
        }else {
            fail();
        }
    }

    public void attack3() {
        int mp = 80;
        int damage =10;
        String name="万众倾倒";
        if (useMp(mp)) {
            use(damage,name);
        }else {
            fail();
        }
    }
    public void use(int damage,String name){
        int before=getDamage();
        setDamage(getDamage()+damage);
        int after=getDamage();
        System.out.println(getName()+"释放了"+name+",攻击从"+before+"到"+after);
    }
    public void fail(){
        System.out.println("技能释放失败");
    }

    public void talk() {
        System.out.println("提莫一击");
    }
}
